package Controller;

import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class ListMemSelectionListener implements ListSelectionListener {
    public void valueChanged(ListSelectionEvent e) { 
        ListSelectionModel lsm = (ListSelectionModel)e.getSource();
      
        if (!lsm.getValueIsAdjusting() && !lsm.isSelectionEmpty()) {
            int minIndex = lsm.getMinSelectionIndex();
            int maxIndex = lsm.getMaxSelectionIndex();
            for (int i = minIndex; i <= maxIndex; i++) {
                if (lsm.isSelectedIndex(i)) {
                	 String str[] = GestionRepertoire.getFenetre().getList2().getModel().getElementAt(i).toString().split(" ");
                	GestionRepertoire.setC(str);
                	GestionRepertoire.getFenetre().updateMem(GestionRepertoire.getRepertoire().getContactInfo(str));
                }
            }
        }
        
    }
}
